function inicializa_xhr() {
		if (window.XMLHttpRequest) {
			return new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			return new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
function cargarExisteYaEmailCliente() {
	peticion = inicializa_xhr();
	if (peticion) {
		var email = document.getElementById("email").value;
		peticion.onreadystatechange = muestraExisteYaEmailCliente;
		peticion.open("POST", "comprobarExisteYaEmailCliente", true);
		peticion.setRequestHeader("Content-Type",
				"application/x-www-form-urlencoded");
		peticion.send("email=" + email );
	}
}
function muestraExisteYaEmailCliente() {
	if (peticion.readyState == 4) {
		if (peticion.status == 200) {
			var ErrorEmail = document.getElementById("ErrorEmail");
			var email = document.getElementById("email");
			if(peticion.responseText=="SI"){
				ErrorEmail.innerHTML = "En uso";
				email.setCustomValidity("Este emai ya existe");				
			}else{
				ErrorEmail.innerHTML = " ";
				email.setCustomValidity("");
				
			}
			
			
		}
	}
}